<% provide(:title, @post.title) %>
<div class="concard noflex nobgc">
<div class="cti"><%= @post.title %></div>
<div class="cinfo">
<div class="auth">
作者：<b><%= @post.user.name %></b>
</div>
<div class="ctim">
发布于<b><%= @post.created_at.strftime("%Y-%m-%d") %></b>
</div>
<div class="cedit">
<% if current_user %>
<% if current_user.admin? or current_user == @post.user_id %>
<%= link_to "编辑" , edit_post_path(@post.id) %>
<% end %>
<% end %>
</div>
<div class="ctag">
<b><%= @post.tag.Title %></b>
</div>
</div>
<div class="cbo">
<%= md(@post.content_html) %>
</div>
</div>
<div class="concard noflex nobgc">
<div class="cti">评论</div>
<div id="expsl" style="display:none">
    <button class="expsel" onclick="javascript:exp(this.innerText)">・ࡇ・</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">є(･◇･｡)э</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">₍ᐢ •⌄• ᐢ₎</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">( ˘͈ ᵕ ˘͈ )</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">( ⸝⸝⸝⁼̴́◡︎⁼̴̀⸝⸝⸝) ​​​</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">Σ(ŎдŎ|||)ﾉﾉ​​​</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">'◡'​​​</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">ಥ_ಥ</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">.^◡^.​​​</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">ʕ•̀ o • ʔ</button>
    <button class="expsel" onclick="javascript:exp(this.innerText)">o(´^｀)o​​​</button>
</div>

<%= form_with(model: [ @post, @post.comments.build ], local: true) do |f| %>
<div id="comin">
<%= f.text_area :content, id:"comtext" ,class:"comment", required:"true",wrap:"off",placeholder:"在这里输入评论……"%>
<button class="conex" onclick="javascript:showexp()" type="button">'ㅅ'</button>
 <% if current_user.nil? %>
<%= f.submit "发布", class: "cbtn", disabled: "true" , title:"未登录，无法发布评论"%>
<% else %>
<%= f.submit "发布", class: "cbtn"%>
<% end %>
</div>
<% end %>
<% @post.comments.each do |comcon| %>
<div class="comitem">
<% if comcon.user_id %>
    <div class="uname">
    <%= User.find_by(id:comcon.user_id).name %>
    </div>
  <% end %>
    <span class="ccon"><%= comcon.content %></span>
    <% if comcon.created_at %>
    <span class="ctime"><%= comcon.created_at.strftime("%Y-%m-%d") %></span>
    <div class="footerline cline"></div>
<% end %>
</div>
<% end %>
</div>
